package com.xcc.core.spder.test.mingchengsz;

import java.util.Scanner;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import com.xcc.core.config.PropertiesUtil;
import com.xcc.core.spder.thread.HttpClient;
import com.xcc.core.spder.thread.SpaderInterface;

public class SpderSz {
    
    
        public static void main(String[] args) throws Exception {
          Document mDocument=Jsoup.connect(PropertiesUtil.getValue("SpderSz.2500sz.url"))
            .ignoreContentType(false)
            .get();
       //   http://suzhou.bendibao.com/
          
          Elements as=  mDocument.body().select("a");
          
          as.forEach(a->{
              if(!a.text().equals("")&&a.attr("href").contains("http")) {
                  System.out.println(a.text()+","+a.attr("href"));   
              }else if(!a.text().equals("")) {
                  System.out.println(a.text()+","+PropertiesUtil.getValue("SpderSz.bendibao.url")+a.attr("href"));   
              }
           
           });
          /* Elements meishis=  mDocument
              .body().getElementsByClass("column i1");
          
          Elements caijin=null;
          Elements meishiE=null;
          meishis.forEach(meishi->{
              Elements  as= meishi.select("a") ;
              as.forEach(a->{
                 System.out.println(a.text()+","+a.attr("href"));   
              });
          });
          */
          
          
          Scanner scan=new Scanner(System.in);
          while(true) {
              System.out.println("输入url：");
             String url= scan.nextLine();
             SpaderInterface client =new HttpClient();
             Element atr=(Element)client.excetor(url);
             System.out.println(atr);
          }
          
          
        }
        
        
        
}
